package es.xpt.ysf.commons.issues.model;

import java.util.Date;
import java.util.List;

import es.xpt.ysf.commons.issues.model.Issue.IssuePriority;
import es.xpt.ysf.commons.issues.model.Issue.IssueResolution;
import es.xpt.ysf.commons.issues.model.Issue.IssueStatus;

public class IssueValue {
	
	private String id;
	private Date date;
	private IssueResolution resolution;
	private IssueStatus status;
	private IssuePriority priority;
	private String entity;
	private String entityId;
	private String businessArea;
	private Object[] parameters;
	private String user;
	private Issue issue;
	private Object jcrData;
	
	private List<IssueHistory> issueHistoryList;
	
	public IssueValue () {
		
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public IssueResolution getResolution() {
		return resolution;
	}
	public void setResolution(IssueResolution resolution) {
		this.resolution = resolution;
	}
	public IssueStatus getStatus() {
		return status;
	}
	public void setStatus(IssueStatus status) {
		this.status = status;
	}
	public IssuePriority getPriority() {
		return priority;
	}
	public void setPriority(IssuePriority priority) {
		this.priority = priority;
	}
	public String getEntity() {
		return entity;
	}
	public void setEntity(String entity) {
		this.entity = entity;
	}
	public String getEntityId() {
		return entityId;
	}
	public void setEntityId(String entityId) {
		this.entityId = entityId;
	}
	
	public Object[] getParameters() {
		return parameters;
	}
	public void setParameters(Object[] parameters) {
		this.parameters = parameters;
	}
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public Issue getIssue() {
		return issue;
	}
	public void setIssue(Issue issue) {
		this.issue = issue;
	}

	public void setIssueHistoryList(List<IssueHistory> issueHistoryList) {
		this.issueHistoryList = issueHistoryList;
	}

	public List<IssueHistory> getIssueHistoryList() {
		return issueHistoryList;
	}

	public void setBusinessArea(String businessArea) {
		this.businessArea = businessArea;
	}

	public String getBusinessArea() {
		return businessArea;
	}

	public Object getJcrData() {
		return jcrData;
	}

	public void setJcrData(Object jcrData) {
		this.jcrData = jcrData;
	}
	
	public String getParametersString() {
		StringBuffer result = null;
		if (parameters!=null && parameters.length>0) {
			result = new StringBuffer(1024);
			for (Object o:parameters) {
				result.append((o!=null) ? o.toString()+"\n":"");
			}			
		}
		return result!=null ? result.toString() : ""; 
	}
	
}
